package com.wang.project.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wang.project.common.DeleteRequest;
import com.wang.project.common.idRequest;
import com.wang.project.model.dto.interfaceInfo.InterfaceInfoAddRequest;
import com.wang.project.model.dto.interfaceInfo.InterfaceInfoInvokeRequest;
import com.wang.project.model.dto.interfaceInfo.InterfaceInfoQueryRequest;
import com.wang.project.model.dto.interfaceInfo.InterfaceInfoUpdateRequest;
import com.wang.project.model.entity.InterfaceInfo;
import com.wang.project.model.vo.interfaceInfo.InterfaceInfoVO;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 胡歌的腿毛
 * @description 针对表【interface_info(接口信息表)】的数据库操作Service
 * @createDate 2023-05-06 15:05:47
 */
public interface InterfaceInfoService extends IService<InterfaceInfo> {

    void validInterfaceInfo(InterfaceInfo interfaceInfo, boolean add);

    /**
     * 检验测试接口方法的参数 权限等
     *
     * @param interfaceInfoInvokeRequest
     * @param request
     * @return
     */
    Boolean validTestInterface(InterfaceInfoInvokeRequest interfaceInfoInvokeRequest, HttpServletRequest request);


    /**
     * 创建接口
     *
     * @param interfaceInfoAddRequest
     * @param request
     * @return
     */
    Boolean addInterfaceInfo(InterfaceInfoAddRequest interfaceInfoAddRequest, HttpServletRequest request);

    /**
     * 删除接口
     *
     * @param deleteRequest
     * @param request
     * @return
     */
    Boolean deleteInterfaceInfo(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 更新接口
     *
     * @param interfaceInfoUpdateRequest
     * @param request
     * @return
     */
    Boolean updateInterfaceInfo(@RequestBody InterfaceInfoUpdateRequest interfaceInfoUpdateRequest,
                                HttpServletRequest request);

    /**
     * 管理员 获取接口列表
     *
     * @param interfaceInfoQueryRequest
     * @return
     */
    List<InterfaceInfo> listInterfaceInfo(InterfaceInfoQueryRequest interfaceInfoQueryRequest);


    /**
     * 分页获取接口信息列表
     *
     * @param interfaceInfoQueryRequest
     * @param request
     * @return
     */
    Page<InterfaceInfo> listInterfaceInfoByPage(InterfaceInfoQueryRequest interfaceInfoQueryRequest, HttpServletRequest request);

    /**
     * 上线接口
     *
     * @param idRequest
     * @param request
     * @return
     */
    Boolean onlineInterfaceInfo(idRequest idRequest, HttpServletRequest request);

    /**
     * 下线接口
     *
     * @param idRequest
     * @param request
     * @return
     */
    Boolean offlineInterfaceInfo(idRequest idRequest, HttpServletRequest request);


    List<InterfaceInfoVO> getUserInterfaceInfoList(InterfaceInfoQueryRequest interfaceInfoQueryRequest, HttpServletRequest request);
}
